package com.dys.filter;

import javax.servlet.*;
import java.io.IOException;

/**
 * @className: com.dys.filter.Filter02
 * @description: 过滤器
 * @author: pine cone
 * @version: v1.0.0
 * @createTime: 2024/09/24 22:19
 */
public class Filter02 implements Filter {
    public Filter02() {
        System.out.println("Filter02的构造器......");
    }

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("自定义过滤初始化方法......");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("执行Filter02的doFilter方法......");
        System.out.println("Filter02 正在过滤请求");
        filterChain.doFilter(servletRequest, servletResponse);
        System.out.println("Filter02 正在过滤响应");
    }

    @Override
    public void destroy() {
        System.out.println("自定义过滤器销毁方法......");
    }
}
